﻿using System;

namespace Sanelib.Common.SystemSettings
{
    public static class Globals
    {
        public static string RootFolder
        {
            get
            {
                var rootFolder = AppDomain.CurrentDomain.BaseDirectory;
                if (!rootFolder.EndsWith("\\")) rootFolder = rootFolder + "\\";
                return rootFolder;
            }
        }

        public static string LogFolder
        {
            get
            {
                return CreateOrGetCustomPath("Logs\\");
            }
        }

        public static string ConfigFolder
        {
            get
            {
                return CreateOrGetCustomPath("Configs\\");
            }
        }

        public static string DatabaseScriptFolder
        {
            get
            {
                return CreateOrGetCustomPath("..\\Deployment\\SqlScripts\\");
            }
        }

        public static string CreateOrGetCustomPath(string relativePath)
        {
            var path = RootFolder + relativePath;
            if (!System.IO.Directory.Exists(path)) System.IO.Directory.CreateDirectory(path);
            return path;
        }
    }
}